<template>
	<view class="mySearch" :style="{backgroundColor:props.backgroundColor}">
		<view class="mySearch_box" :style="{borderRadius:props.borderRadius+'px'}" @click="searchHandler">
			<uni-icons type="search" size="17" color="gray"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script setup>
	// 父组件传递数据
	const props = defineProps({
		borderRadius: {
			type: Number,
			default: 5
		},
		backgroundColor: {
			type: String,
			default: "#C00000"
		}
	})
	// 子组件传递数据
	const emit = defineEmits(['myClick'])
	// 触发搜索框
	const searchHandler = () => {
		emit("myClick")
	}
</script>

<style lang="scss" scoped>
	.mySearch {
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: sticky;
		top: 0;
		z-index: 9999;

		.mySearch_box {
			background-color: white;
			width: 88%;
			height: 72rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			.placeholder {
				font-size: 24rpx;
				color: gray;
			}
		}
	}
</style>
